auto check = [&](int x, int y)->int {
        int res = 0;
        queue<pair<int, int>> qu;
        vector<vector<int>>ss(n, vector<int>ss(m));
        qu.push({x, y});
        vector<vector<int>> st(n, vector<int>(m));
        auto func = [&](int i, int j) {
            for(int k = 0; k < 4; k++) {
                int tx = i + dx[k], ty =  j + dy[k];
                if(tx >= 0 && tx < n && ty >= 0 && ty < m && s[tx][ty] == '0'){
                    res++;
                    //                 cout << tx << ' ' << ty << endl;
                    s[tx][ty] = '2';
                }
            }
        };
        func(x, y);
        while(qu.size()) {
            auto [x, y] = qu.front();
            qu.pop();
            for(int i = 0; i < 4; i++) {
                int tx = x + dx[i], ty=  y + dy[i];
                if(tx >= 0 && tx < n && ty >= 0 && ty < m && st[tx][ty] == 0 && s[tx][ty] == '1') {
                    func(tx, ty);
                    qu.push({tx, ty});
                }
            }
            st[x][y] = 1;
        }
        return res;
    };